package com.cn.xiaonuo.tcrfinance.tcrgnete.controller;

import com.cn.xiaonuo.common.entity.BusinessMessage;
import com.cn.xiaonuo.tcrfinance.tcrgnete.param.*;
import com.cn.xiaonuo.tcrfinance.tcrgnete.service.GnetePayService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

/**
 * @BelongsProject: slb-reports-java
 * @Author: likui
 * @CreateTime: 2022-11-03  15:17
 * @Description: 聚合支付
 */
@RestController
public class GnetePayController {

    @Autowired
    private GnetePayService gnetePayService;

    @ApiOperation(value = "现金资产管理--资产信息(余额)", notes = "现金资产管理--资产信息(余额)")
    @PostMapping(value = "/api/common/gnetePay/accountBalance")
    public BusinessMessage accountBalance(@RequestBody String PSno){
        return gnetePayService.accountBalance(PSno);
    }

    @ApiOperation(value = "结算账户提现", notes = "结算账户提现")
    @PostMapping(value = "/api/gnetePay/withdrawal")
    public BusinessMessage withdrawal(@RequestBody WithdrawalParam param){
        return gnetePayService.withdrawal(param);
    }

    @ApiOperation(value = "短信验证码发送", notes = "短信验证码发送")
    @PostMapping(value = "/api/gnetePay/verificationCode")
    public BusinessMessage verificationCode(@RequestBody String phone){
        return gnetePayService.verificationCode(phone);
    }

    @ApiOperation(value = "资产信息", notes = "资产信息")
    @PostMapping(value = "/api/gnetePay/fundInformation")
    public BusinessMessage fundInformation(@RequestBody FundInformationParam param){
        return gnetePayService.fundInformation(param);
    }

    @ApiOperation(value = "资金流水记录", notes = "资金流水记录")
    @PostMapping(value = "/api/gnetePay/capitalFlow")
    public BusinessMessage capitalFlow(@RequestBody CapitalFlowParam param){
        return gnetePayService.capitalFlow(param);
    }

    @ApiOperation(value = "提现记录", notes = "提现记录")
    @PostMapping(value = "/api/gnetePay/withdrawalRecord")
    public BusinessMessage withdrawalRecord(@RequestBody CapitalFlowParam param){
        return gnetePayService.withdrawalRecord(param);
    }

    @ApiOperation(value = "同步提现状态定时", notes = "同步提现状态定时")
    @PostMapping(value = "/api/common/gnetePay/timingUpdate")
    public BusinessMessage timingUpdate() throws Exception {
         return gnetePayService.timingUpdate();
    }

    /**
     * 此导出接口暂未使用，目前为前端导出，如果后期需要使用可调试后直接调用
     * @param response
     * @param param
     * @return
     */
    @ApiOperation(value = "提现记录--导出", notes = "提现记录--导出")
    @GetMapping(value = "/api/gnetePay/withdrawalRecordExcel")
    public BusinessMessage withdrawalRecordExcel(HttpServletResponse response, CapitalFlowParam param){
        return gnetePayService.withdrawalRecordExcel(response,param);
    }

    @ApiOperation(value = "查询商户三方余额", notes = "查询商户三方余额")
    @PostMapping(value = "/api/gnetePay/queryThirdBalance")
    public BusinessMessage queryThirdBalance(@RequestBody ThirdBalanceParam param){
        return gnetePayService.queryThirdBalance(param);
    }
}
